/*
 * @(#) WorkPlanService.java 2013-5-28 下午1:58:47
 *
 * Copyright 2013 Rockwell Automation, Inc. All rights reserved.
 * Rockwell Automation PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */package com.osi.mes.im;

import java.util.Vector;

import pnuts.lang.Context;

import com.datasweep.compatibility.client.ATHandler;
import com.datasweep.compatibility.client.ATRow;
import com.datasweep.compatibility.client.ATRowFilter;
import com.datasweep.compatibility.client.Response;
import com.datasweep.compatibility.pnuts.Functions;
import com.osi.mes.base.BaseService;

public class BusinessPartnerService extends BaseService
{

	public BusinessPartnerService(Context context)
	{
		super(context);
	}

	public BusinessPartnerService(Functions functions)
	{
		super(functions);
	}
	
	public Vector<ATRow> getBusinessPartners(ATRowFilter atRowFilter)
	{
		return super.getATRows(atRowFilter);
	}
	
	public Response saveBusinessPartner(ATRow businessPartner)
	{
		return super.saveATRow(businessPartner);
	}
	
	public Response deleteBusinessPartner(ATRow businessPartner)
	{
		return super.deleteAtRow(businessPartner);
	}
	
	public Response addBusinessPartner(String code, String name, String type, String class1, String class2, String class3, String class4, String class5)
	{
		ATHandler atHandler = getFunctions().createATHandler(AT_TABLE_NAME_BUSINESS_PARTNER);
		ATRow atRow = atHandler.createATRow();
		atRow.setValue(AT_COLUMN_NAME_BUSINESS_PARTNER_CODE, code);
		atRow.setValue(AT_COLUMN_NAME_BUSINESS_PARTNER_NAME, name);
		atRow.setValue(AT_COLUMN_NAME_BUSINESS_PARTNER_TYPE, type);
		atRow.setValue(AT_COLUMN_NAME_BUSINESS_PARTNER_CLASS1, class1);
		atRow.setValue(AT_COLUMN_NAME_BUSINESS_PARTNER_CLASS2, class2);
		atRow.setValue(AT_COLUMN_NAME_BUSINESS_PARTNER_CLASS3, class3);
		atRow.setValue(AT_COLUMN_NAME_BUSINESS_PARTNER_CLASS4, class4);
		atRow.setValue(AT_COLUMN_NAME_BUSINESS_PARTNER_CLASS5, class5);
		return saveBusinessPartner(atRow);
	}	
}
